ALMaSS  1.0
The Animal, Landscape and Man Simulation System
hare_all.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2011, Christopher John Topping, University of Aarhus
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided
7 that the following conditions are met:
8 
9 Redistributions of source code must retain the above copyright notice, this list of conditions and the
10 following disclaimer.
11 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12 the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
15 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
17 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
19 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 ********************************************************************************************************
23 */
36 //---------------------------------------------------------------------------
37 #ifndef HaresH
38 #define HaresH
39 
40 //---------------------------------------------------------------------------
41 
42 class THare;
44 class Hare_Female;
45 
46 //------------------------------------------------------------------------------
50 typedef vector<THare*> TListOfHares;
51 //---------------------------------------------------------------------------
52 
56 typedef enum {
64 
69 typedef enum
70 {
80  tohs_DestroyObject // Used to signal that all necessary behaviour is
81  // done, safe to remove the object
83 
88 typedef enum
89 {
103 
108 struct MRR_Entry{
112 };
113 
118 class MRR_Data {
119 public:
120  MRR_Data();
121  void AddEntry(int a_RefNum);
122  void OutputToFile();
124 protected:
125  // Class for the MRR data before it is written to file-
127  vector <MRR_Entry> m_Entries;
128 };
129 
135 {
136  public:
137  int x;
138  int y;
139  int age;
143  int RefNum;
144  double weight;
145 };
146 
147 /*-------------------------------------------------------------------------------------------
148 -------------------------------------- THARE ------------------------------------------
149 ---------------------------------------------------------------------------------------------*/
154 class THare : public TAnimal
155 {
159 protected:
160  // Attributes
170  int m_Age;
180  double m_weight;
185  double m_old_weight;
213  double m_fatReserve;
223  double m_EnergyMax;
228  double m_KJRunning; // KJ/metre
233  double m_KJWalking; // KJ/metre
238  double m_KJForaging; // KJ/minute
243  double m_SpeedRunning; // metre/min
248  double m_SpeedWalking; // metre/min
256  int m_peg_x;
260  int m_peg_y;
265  int m_RefNum;
266 
286  int m_expDensity[365];
295  bool m_IamSick;
296 
312 
313 public:
318  static double* m_vegPalatability;
319  // Methods
324  THare(int p_x, int p_y, Landscape* p_L, THare_Population_Manager* p_PPM);
329  void THareInit(int p_x, int p_y, THare_Population_Manager* p_PPM);
334  virtual ~THare();
339  virtual TTypeOfHareState st_Dispersal();
344  virtual void BeginStep (void) {}
349  virtual void Step (void) {}
354  virtual void EndStep (void) { MovePeg(); }
355 
356 // Interface Functions
360  double GetWeight() {
361  return m_weight;
362  }
370  double GetTotalWeight() {
371  return m_weight*3.8+m_fatReserve;
372  }
377  int GetAge() {
378  return m_Age;
379  }
387  void ON_MumDead(Hare_Female* a_Mum) {
388  if (a_Mum != m_MyMum) {
389  m_OurLandscape->Warn("Hare_Infant::On_MumDead - not my mum!!",NULL);
390  exit(1);
391  }
392  // I am now an orphan
393  m_MyMum=NULL;
394  }
399  void SetMum(Hare_Female* /*a_af*/) { ; }
404  Hare_Female* GetMum() { return m_MyMum; }
409  double GetRMR();
414  virtual bool WasPredated();
419  int GetRefNum() { return m_RefNum; }
424  virtual void ON_Dead( void ) {
425  ;
426  }
431  void loadVegPalatability( void );
432 protected:
437  bool Run(int a_dist, int a_direction);
442  void EnergyBalance(TTypeOfActivity a_activity, int dist);
447  void TimeBudget(TTypeOfActivity a_activity, int dist);
452  void st_Dying();
457  virtual void Running(int a_max_dist);
462  void Walking(int a_dist, int a_direction);
467  double Forage(int &time); // Returns energy obtained
472  double ForageP(int &time); // Returns energy obtained
482  virtual void GeneralEndocrineDisruptor(double /* a_pesticide_dose */) { ; }
487  virtual void GeneralOrganoPhosphate(double /* a_pesticide_dose */) { ; }
492  double ForageSquare(int a_x, int a_y);
497  double ForageSquareP(int a_x, int a_y, double *a_pestexposure);
502  int GetPegDistance();
507  int GetPegPull();
512  int GetPegDirection();
517  void MovePeg();
522  bool OnFarmEvent( FarmToDo event );
523 };
524 
530 {
531 public:
532 // Methods
534  virtual ~THare_Population_Manager (void);
536  virtual void TheAOROutputProbe();
537  void CreateObjects(int ob_type, TAnimal *pvo,void* null ,
538  struct_Hare* data,int number);
543  double GetRMR(int a_age, double a_size);
548  int GetHareRefNum() { return ++m_RefNums; }
552  double GetMaxDailyGrowthEnergy(int a_age) {
553 #ifdef __BOUNDSCHECK
554  if ((a_age<0) || (a_age>5000)) {
555  m_TheLandscape->Warn( "Hare GetMaxDailyGrowthEnergy a_age out of bounds", NULL );
556  exit( 1 );
557  }
558 #endif
559  return m_MaxDailyGrowthEnergy[a_age];
560  }
565  double GetMaxDailyGrowthEnergyP(int a_age) {
566 #ifdef __BOUNDSCHECK
567  if ((a_age<0) || (a_age>5000)) {
568  m_TheLandscape->Warn( "Hare GetMaxDailyGrowthEnergyP a_age out of bounds", NULL );
569  exit( 1 );
570  }
571 #endif
572  return m_MaxDailyGrowthEnergyP[a_age];
573  }
578  double GetMaxDailyGrowthEnergyF(int a_age) {
579 #ifdef __BOUNDSCHECK
580  if ((a_age<0) || (a_age>5000)) {
581  m_TheLandscape->Warn( "Hare GetMaxDailyGrowthEnergyF a_age out of bounds", NULL );
582  exit( 1 );
583  }
584 #endif
585  return m_MaxDailyGrowthEnergyF[a_age]; }
590  double GetGrowthEfficiency(int a_age) {
591 #ifdef __BOUNDSCHECK
592  if ((a_age<0) || (a_age>5000)) {
593  m_TheLandscape->Warn( "Hare GetGrowthEfficiency a_age out of bounds", NULL );
594  exit( 1 );
595  }
596 #endif
597  return m_GrowthEfficiency[a_age]; }
602  double GetGrowthEfficiencyP(int a_age) {
603 #ifdef __BOUNDSCHECK
604  if ((a_age<0) || (a_age>5000)) {
605  m_TheLandscape->Warn( "Hare GetGrowthEfficiencyP a_age out of bounds", NULL );
606  exit( 1 );
607  }
608 #endif
609  return m_GrowthEfficiencyP[a_age]; }
614  double GetGrowthEfficiencyF(int a_age) {
615 #ifdef __BOUNDSCHECK
616  if ((a_age<0) || (a_age>5000)) {
617  m_TheLandscape->Warn( "Hare m_GrowthEfficiencyF a_age out of bounds", NULL );
618  exit( 1 );
619  }
620 #endif
621  return m_GrowthEfficiencyF[a_age]; }
626  double GetKJperM(int a_size) {
627 #ifdef __BOUNDSCHECK
628  if ((a_size<0) || (a_size>7000)) {
629  char sz[255];
630  _itoa(a_size,sz,10);
631  m_TheLandscape->Warn( "Hare GetKJperM a_size out of bounds", sz );
632  exit( 1 );
633  }
634 #endif
635  return m_KJperM[a_size]; }
636  int GetLitterSize(int noLitters);
641  void AddHareDensity(int x, int y, Hare_Object a_type) { m_DensityMap[a_type][x >> __DENSITYSHIFT][y >> __DENSITYSHIFT]++; }
646  void SubtractHareDensity(int x, int y, Hare_Object a_type) { m_DensityMap[a_type][x >> __DENSITYSHIFT][y >> __DENSITYSHIFT]--; }
651  int GetInfantDensity(int x, int y) { return m_DensityMap[hob_Infant][x >> __DENSITYSHIFT][y >> __DENSITYSHIFT]; }
656  int GetYoungDensity(int x, int y) { return m_DensityMap[hob_Young][x>>__DENSITYSHIFT][y>>__DENSITYSHIFT]; }
661  int GetJuvenileDensity(int x, int y) { return m_DensityMap[hob_Juvenile][x>>__DENSITYSHIFT][y>>__DENSITYSHIFT]; }
666  int GetMaleDensity(int x, int y) { return m_DensityMap[hob_Male][x>>__DENSITYSHIFT][y>>__DENSITYSHIFT]; }
671  int GetFemaleDensity(int x, int y) { return m_DensityMap[hob_Female][x>>__DENSITYSHIFT][y>>__DENSITYSHIFT]; }
676  int GetTotalDensity(int x, int y) { return m_DensityMap[5][x>>__DENSITYSHIFT][y>>__DENSITYSHIFT]; }
681  int GetAdultDensity(int x, int y)
682  {
683  return (m_DensityMap[hob_Male][x>>__DENSITYSHIFT][y>>__DENSITYSHIFT] + m_DensityMap[hob_Female][x>>__DENSITYSHIFT][y>>__DENSITYSHIFT]);
684  }
689  int GetDelayedAdultDensity(int x, int y) {
690  return m_DensityMap[6][x>>__DENSITYSHIFT][y>>__DENSITYSHIFT];
691  }
700  double GetInterference(int h) {
701 #ifdef __BOUNDSCHECK
702  if ((h<0) || (h>2499)) {
703  m_TheLandscape->Warn( "Hare Interference range out of bounds", NULL );
704  exit( 1 );
705  }
706 #endif
707  return m_Interference[h]; //[m_variableDD];
708  }
713  double GetPolyFood(int a_poly) { return m_PolyFood[a_poly]; }
718  void SetPolyFood(int a_poly, double a_value ) { m_PolyFood[a_poly]=a_value; }
723  void BodyBurdenOut(int a_year, int a_day, double a_bb, double a_mgkg) {
724  fprintf(BodyBurdenPrb, "%d\t%d\t%g\t%g\n", a_year, a_day, a_bb, a_mgkg);
725  }
726 
746  double m_DMWeight[5001];
751 protected:
752 // Attributes
756  int m_shot;
760  double m_Interference[2500]; //[21]; // this limit should never be reached, but it may be under debugging tests so watch out.
762  int m_DensityMap[8][200][200];//NB maps larger than 50km in any one dimension -> memory overun
766  int m_LitterSize[12][7];
768  double* m_PolyFood;
769  // Energetic constants will go into these arrays
770  // They are filled by the Init method
772  double m_RMR[2][366]; // Will also needs bounds checking
774  double m_MaxDailyGrowthEnergy[5001]; // Will also needs bounds checking
776  double m_GrowthEfficiency[5001]; // Will also needs bounds checking
778  double m_MaxDailyGrowthEnergyP[5001]; // Will also needs bounds checking
780  double m_MaxDailyGrowthEnergyF[5001]; // Will also needs bounds checking
782  double m_GrowthEfficiencyP[5001]; // Will also needs bounds checking
784  double m_GrowthEfficiencyF[5001]; // Will also needs bounds checking
786  double m_KJperM[7001];
791 // Methods
792  void Init();
793  void CalcLitterSize(double mean, double SD, int litter);
794 // virtual bool StepFinished();
795  virtual void DoFirst();
796 // virtual void DoBefore(){}
797 // virtual void DoAfter(){}
798  virtual void DoLast();
799  virtual void DoAlmostLast();
800  void POMOutputs();
801  void MRROutputs();
803  virtual void TheRipleysOutputProbe(FILE* a_prb);
805  void ExtraPopMort( void );
806  void Hunting( void );
807  void HuntingGrid( void );
809  virtual void Catastrophe();
810 };
811 
812 
817 class Hare_Infant : public THare
818 {
819 public:
820  virtual void BeginStep (void);
821  virtual void Step (void);
822  virtual void EndStep (void);
827  Hare_Infant(int p_x, int p_y, Landscape * p_L,THare_Population_Manager * p_PPM);
829  void ReInit(struct_Hare a_data);
831  void Init();
836  virtual ~Hare_Infant();
837  // Interface Functions
842  virtual void ON_Dead();
843  void ON_BeingFed(double a_someMilk);
851  void SetWeight(double w) { m_weight=w; }
856  void SetMum(Hare_Female* a_af) { m_MyMum=a_af; }
857 protected:
859  void st_NextStage();
864  bool OnFarmEvent( FarmToDo event );
865  // Attributes
866 };
867 
872 class Hare_Young : public Hare_Infant
873 {
874 public:
875  virtual void BeginStep (void);
876  virtual void Step (void);
877  virtual void EndStep (void);
878  Hare_Young(int p_x, int p_y, Landscape * p_L,
879  THare_Population_Manager * p_PPM, double p_weight);
881  void ReInit(struct_Hare a_data);
883  void Init(double p_weight);
884  virtual ~Hare_Young();
885  // Interface
890  virtual void ON_Dead();
891 protected:
907  void st_NextStage();
917  bool OnFarmEvent( FarmToDo event );
918 };
919 
924 class Hare_Juvenile : public THare
925 {
926 public:
927  virtual void BeginStep (void);
928  virtual void Step (void);
929  virtual void EndStep (void);
930  Hare_Juvenile(int p_x, int p_y, Landscape * p_L,THare_Population_Manager *
931  p_PPM, double p_weight);
933  void ReInit(struct_Hare a_data);
935  void Init(double p_weight);
936  virtual ~Hare_Juvenile();
937  // Interface
938  virtual void ON_Dead();
939 protected:
940  // States
956  void st_NextStage();
962 // Methods
967  bool ShouldMature();
969  virtual bool WasPredated();
970 };
971 
976 class Hare_Male : public Hare_Juvenile
977 {
978 public:
979  virtual void BeginStep (void);
980  virtual void Step (void);
981  virtual void EndStep (void);
986  Hare_Male(int p_x, int p_y, Landscape * p_L,THare_Population_Manager * p_PPM,
987  double p_weight, int a_age, int a_Ref);
989  void ReInit(struct_Hare a_data);
991  void Init(double p_weight, int a_age, int a_Ref);
996  virtual ~Hare_Male();
997 // Interface
998  virtual void ON_Dead();
999 protected:
1000  // States
1021  // Methods
1023  virtual void InternalPesticideHandlingAndResponse();
1028  virtual void GeneralEndocrineDisruptor(double /* a_pesticide_dose */);
1033  virtual void GeneralOrganoPhosphate(double /* a_pesticide_dose */);
1034 };
1035 
1041 {
1042 protected:
1043  // Attributes
1050  //double m_SurplusEnergy;
1061 
1063  void UpdateOestrous();
1065  void UpdateGestation();
1067  void GiveBirth();
1069  APoint PlaceYoung();
1071  void DoLactation();
1073  void Mating();
1074 public:
1076  virtual void BeginStep(void);
1078  virtual void Step(void);
1080  virtual void EndStep(void);
1082  Hare_Female(int p_x, int p_y, Landscape * p_L, THare_Population_Manager *p_PPM, double p_weight, int a_age, int a_Ref);
1084  void ReInit(struct_Hare a_data);
1086  void Init(double p_weight, int a_age, int a_Ref);
1088  virtual ~Hare_Female();
1089  // Interface functions
1091  void dumpEnergy();
1093  void SetSterile() { m_sterile = true; }
1095  virtual void ON_Dead();
1097  bool UpdateYoung(THare* a_old, THare* a_new);
1099  void AddYoung(THare* a_new);
1101  void ON_YoungKilled(THare* a_young);
1103  void ON_RemoveYoung(THare* a_young);
1105  void AllYoungKilled();
1107  void AllYoungMatured();
1108  // *** DeBugging Methods ***
1110  bool ON_AreYouMyMum(THare* a_young);
1112  bool SanityCheckYoungList();
1113  // *** End Debug ***
1114 
1115 protected:
1116  // States
1142 //Methods
1144  virtual void InternalPesticideHandlingAndResponse();
1149  virtual void GeneralEndocrineDisruptor(double a_pesticide_dose);
1154  virtual void GeneralOrganoPhosphate(double a_pesticide_dose);
1155 };
1156 //---------------------------------------------------------------------------
1157 #endif
A simple class defining an x,y coordinate set.
Definition: ALMaSS_Setup.h:53
Class for female hares.
Definition: hare_all.h:1041
virtual void ON_Dead()
The female is dead.
Definition: Hare_all.cpp:3956
virtual void BeginStep(void)
Female BeginStep.
Definition: Hare_all.cpp:3162
int m_litter_no
State variable - current litter number.
Definition: hare_all.h:1047
void dumpEnergy()
Used to record energetic status.
Definition: Hare_all.cpp:3472
TTypeOfHareState st_Resting()
Resting.
Definition: Hare_all.cpp:3507
void AddYoung(THare *a_new)
Add a leveret to the list of kids.
Definition: Hare_all.cpp:3844
TTypeOfHareState st_ReproBehaviour()
Reproductive behaviour control.
Definition: Hare_all.cpp:3520
int m_OestrousCounter
State variable - Days in oestrous.
Definition: hare_all.h:1052
virtual ~Hare_Female()
Female Destructor.
Definition: Hare_all.cpp:3156
void ON_RemoveYoung(THare *a_young)
A leveret has matured.
Definition: Hare_all.cpp:3901
virtual void GeneralOrganoPhosphate(double a_pesticide_dose)
Handles internal effects of organophosphate pesticide exposure for female.
Definition: Hare_all.cpp:4393
void GiveBirth()
Produce a litter.
Definition: Hare_all.cpp:3656
void AllYoungMatured()
No more young to look after.
Definition: Hare_all.cpp:3931
bool UpdateYoung(THare *a_old, THare *a_new)
Swap a young list pointer.
Definition: Hare_all.cpp:3823
TTypeOfActivity m_reproActivity
State variable - current reproductive state.
Definition: hare_all.h:1058
void UpdateOestrous()
Update oestrous counter.
Definition: Hare_all.cpp:3580
APoint PlaceYoung()
Find somewhere nice for the babies to hide.
Definition: Hare_all.cpp:3755
void Mating()
Mate.
Definition: Hare_all.cpp:3610
void UpdateGestation()
Update gestation counter.
Definition: Hare_all.cpp:3626
bool m_sterile
State variable - is/not sterile.
Definition: hare_all.h:1049
TTypeOfHareState st_Dispersal()
Female Dispersal.
Definition: Hare_all.cpp:3485
double m_LeveretMaterial
State variable - Mass of foetal material.
Definition: hare_all.h:1056
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: Hare_all.cpp:4008
Hare_Female(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight, int a_age, int a_Ref)
Female Constructor.
Definition: Hare_all.cpp:3117
virtual void Step(void)
Female Step.
Definition: Hare_all.cpp:3236
void ON_YoungKilled(THare *a_young)
A leveret has been killed.
Definition: Hare_all.cpp:3850
bool SanityCheckYoungList()
Debug function.
Definition: Hare_all.cpp:3992
virtual void EndStep(void)
Female EndStep.
Definition: Hare_all.cpp:3291
void Init(double p_weight, int a_age, int a_Ref)
Object initiation.
Definition: Hare_all.cpp:3134
virtual void GeneralEndocrineDisruptor(double a_pesticide_dose)
Handles internal effects of endocrine distrupter pesticide exposure for female.
Definition: Hare_all.cpp:4380
int m_NoYoung
State variable - current litter size.
Definition: hare_all.h:1045
void SetSterile()
Female is sterile.
Definition: hare_all.h:1093
void ReInit(struct_Hare a_data)
Female object reinitiation.
Definition: Hare_all.cpp:3123
TTypeOfHareState st_Foraging()
Female Foraging.
Definition: Hare_all.cpp:3397
int m_GestationCounter
State variable - Days in gestation.
Definition: hare_all.h:1054
void DoLactation()
Lactation.
Definition: Hare_all.cpp:3787
TListOfHares m_MyYoung
Pointer to litter.
Definition: hare_all.h:1060
void AllYoungKilled()
Last leveret predated.
Definition: Hare_all.cpp:3879
TTypeOfHareState st_Developing()
Female Developing.
Definition: Hare_all.cpp:3297
bool ON_AreYouMyMum(THare *a_young)
Debug function.
Definition: Hare_all.cpp:3974
Class for infant hares (stationary, only milk inputs)
Definition: hare_all.h:818
virtual void BeginStep(void)
BeginStep for the Hare_Infant.
Definition: Hare_all.cpp:1308
Hare_Infant(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
Hare infant constructor.
Definition: Hare_all.cpp:1270
virtual void EndStep(void)
EndStep for the Hare_Infant.
Definition: Hare_all.cpp:1390
void SetWeight(double w)
Set the weight.
Definition: hare_all.h:851
bool OnFarmEvent(FarmToDo event)
Do we require a response to a farm event.
Definition: Hare_all.cpp:1408
void ReInit(struct_Hare a_data)
Infant object reinitiation.
Definition: Hare_all.cpp:1276
void SetMum(Hare_Female *a_af)
Set the mother pointer.
Definition: hare_all.h:856
void st_NextStage()
'mature' to become a young
Definition: Hare_all.cpp:1659
void ON_BeingFed(double a_someMilk)
Get energy from milk given.
Definition: Hare_all.cpp:1698
virtual void ON_Dead()
This hare has been killed.
Definition: Hare_all.cpp:1688
TTypeOfHareState st_Developing()
Developmental behaviour for the infant hare.
Definition: Hare_all.cpp:1615
virtual ~Hare_Infant()
Hare infant destructor.
Definition: Hare_all.cpp:1295
void Init()
Object initiation.
Definition: Hare_all.cpp:1285
virtual void Step(void)
Step for the Hare_Infant.
Definition: Hare_all.cpp:1355
Class for juvenile hares (after 5 weeks old, fully mobile)
Definition: hare_all.h:925
void ReInit(struct_Hare a_data)
Juvenile object reinitiation.
Definition: Hare_all.cpp:2225
bool ShouldMature()
Test for maturation.
Definition: Hare_all.cpp:2630
Hare_Juvenile(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight)
Constructor for the juvenile hare object.
Definition: Hare_all.cpp:2219
TTypeOfHareState st_Developing()
The development code for Hare_Juvenile.
Definition: Hare_all.cpp:2522
virtual void Step(void)
Step for Hare_Juvenile.
Definition: Hare_all.cpp:2316
virtual ~Hare_Juvenile()
Destructor for the juvenile hare object.
Definition: Hare_all.cpp:2247
TTypeOfHareState st_Resting()
Juvenile Resting.
Definition: Hare_all.cpp:2507
void st_NextStage()
Maturation to Hare_Male or Hare_Female.
Definition: Hare_all.cpp:2607
TTypeOfHareState st_Dispersal()
Juvenile Dispersal.
Definition: Hare_all.cpp:2449
TTypeOfHareState st_Foraging()
Juvenile foraging.
Definition: Hare_all.cpp:2385
virtual void BeginStep(void)
BeginStep for Hare_Juvenile.
Definition: Hare_all.cpp:2261
virtual bool WasPredated()
Test for mortality.
Definition: Hare_all.cpp:2645
void Init(double p_weight)
Object initiation.
Definition: Hare_all.cpp:2236
virtual void EndStep(void)
BeginStep for Hare_Juvenile.
Definition: Hare_all.cpp:2379
virtual void ON_Dead()
Definition: Hare_all.cpp:2654
Class for male hares.
Definition: hare_all.h:977
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: Hare_all.cpp:3051
TTypeOfHareState st_Developing()
Male Development.
Definition: Hare_all.cpp:2946
Hare_Male(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight, int a_age, int a_Ref)
Constructor.
Definition: Hare_all.cpp:2668
void Init(double p_weight, int a_age, int a_Ref)
Object initiation.
Definition: Hare_all.cpp:2686
void ReInit(struct_Hare a_data)
Male object reinitiation.
Definition: Hare_all.cpp:2675
virtual void ON_Dead()
Definition: Hare_all.cpp:3044
virtual void Step(void)
Step for Hare_Male.
Definition: Hare_all.cpp:2798
TTypeOfHareState st_ReproBehaviour()
Currently Unused.
Definition: Hare_all.cpp:3034
TTypeOfHareState st_Foraging()
Male Foraging.
Definition: Hare_all.cpp:2872
virtual void EndStep(void)
EndStep code for Hare_Male.
Definition: Hare_all.cpp:2859
TTypeOfHareState st_Resting()
Male Resting.
Definition: Hare_all.cpp:2937
virtual void GeneralEndocrineDisruptor(double)
Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this m...
Definition: Hare_all.cpp:3090
virtual ~Hare_Male()
Destructor.
Definition: Hare_all.cpp:2699
virtual void BeginStep(void)
BeginStep for Hare_Male.
Definition: Hare_all.cpp:2715
virtual void GeneralOrganoPhosphate(double)
Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method...
Definition: Hare_all.cpp:3099
Class for young hares (low mobility, milk and solid food inputs)
Definition: hare_all.h:873
Hare_Young(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight)
Constructor for Hare_Young.
Definition: Hare_all.cpp:1716
void st_NextStage()
Maturation to Hare_Juvenile.
Definition: Hare_all.cpp:1970
TTypeOfHareState st_Dispersal()
Not used.
Definition: Hare_all.cpp:1916
TTypeOfHareState st_Resting()
Resting.
Definition: Hare_all.cpp:1926
virtual ~Hare_Young()
Destructor for Hare_Young.
Definition: Hare_all.cpp:1744
bool OnFarmEvent(FarmToDo event)
Response to farm actions.
Definition: Hare_all.cpp:1999
virtual void BeginStep(void)
BeginStep for Hare_Young.
Definition: Hare_all.cpp:1754
void ReInit(struct_Hare a_data)
Young object reinitiation.
Definition: Hare_all.cpp:1722
virtual void Step(void)
Step code for Hare_Young.
Definition: Hare_all.cpp:1801
virtual void ON_Dead()
This hare has been killed.
Definition: Hare_all.cpp:2206
TTypeOfHareState st_Developing()
Developmental code for the young hare.
Definition: Hare_all.cpp:1938
virtual void EndStep(void)
EndStep code for Hare_Young.
Definition: Hare_all.cpp:1851
TTypeOfHareState st_Foraging()
Young foraging.
Definition: Hare_all.cpp:1876
The landscape class containing all environmental and topographical data.
Definition: landscape.h:113
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
Class for running mark-release-recapture experiments.
Definition: hare_all.h:118
int m_currenttrapping
Definition: hare_all.h:126
void AddEntry(int a_RefNum)
Definition: Hare_all.cpp:4298
MRR_Data()
Definition: Hare_all.cpp:4290
void OutputToFile()
Definition: Hare_all.cpp:4340
vector< MRR_Entry > m_Entries
Definition: hare_all.h:127
void IncTrapping()
Definition: hare_all.h:123
Base class for all population managers.
Definition: PopulationManager.h:424
Landscape * m_TheLandscape
Definition: PopulationManager.h:515
The base class for all ALMaSS animal classes.
Definition: PopulationManager.h:205
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
The class that handles all the population lists for hares.
Definition: hare_all.h:530
int m_LitterSize[12][7]
Storage for litter size distributions (not used in default config)
Definition: hare_all.h:766
int GetYoungDensity(int x, int y)
Density function - returns the density of young in the square containing by x,y. Each square is 256x2...
Definition: hare_all.h:656
double m_JuvMortRate
Input variable - Juvenile mortality rate.
Definition: hare_all.h:730
int GetHareRefNum()
Get the next ID number available.
Definition: hare_all.h:548
virtual void TheRipleysOutputProbe(FILE *a_prb)
Standard spatial output.
Definition: Hare_all.cpp:1198
double m_MaxDailyGrowthEnergyF[5001]
Precalculated max growth energy requirement with size for fat
Definition: hare_all.h:780
double m_KJperM[7001]
Precalculated cost of locomotion - KJ per m per kg
Definition: hare_all.h:786
int GetJuvenileDensity(int x, int y)
Density function - returns the density of juveniles in the square containing by x,...
Definition: hare_all.h:661
double GetGrowthEfficiencyP(int a_age)
Get the growth efficiency for this a_age for creating protein.
Definition: hare_all.h:602
int m_RefNums
The last hare ID used
Definition: hare_all.h:754
int GetTotalDensity(int x, int y)
Density function - returns the density of all hares in the square containing by x,...
Definition: hare_all.h:676
double GetMaxDailyGrowthEnergy(int a_age)
Definition: hare_all.h:552
double GetRMR(int a_age, double a_size)
Returns the RMR given a specific age and mass.
Definition: Hare_all.cpp:1034
MRR_Data * m_OurMRRData
Data structure for MarkReleaseRecapture expts
Definition: hare_all.h:788
float m_GoodYearBadYear
Variable for adding stochasticity.
Definition: hare_all.h:742
int GetInfantDensity(int x, int y)
Density function - returns the density of infants in the square containing by x,y....
Definition: hare_all.h:651
double m_RMR[2][366]
Precalculated RMR with age
Definition: hare_all.h:772
double m_YoungMortRate
Input variable - Young mortality rate.
Definition: hare_all.h:738
void ExtraPopMort(void)
An extra global mortality
Definition: Hare_all.cpp:4093
void AddHareDensity(int x, int y, Hare_Object a_type)
Density function - adds one to the density in the square containing by x,y. Each square is 256x256m i...
Definition: hare_all.h:641
int GetFemaleDensity(int x, int y)
Density function - returns the density of females in the square containing by x,y....
Definition: hare_all.h:671
virtual void DoLast()
The last method called before the new time-step starts.
Definition: Hare_all.cpp:763
void CreateObjects(int ob_type, TAnimal *pvo, void *null, struct_Hare *data, int number)
Method used to create new hares.
Definition: Hare_all.cpp:928
void BodyBurdenOut(int a_year, int a_day, double a_bb, double a_mgkg)
BodyBurden output.
Definition: hare_all.h:723
void SetPolyFood(int a_poly, double a_value)
Set polygon food quality.
Definition: hare_all.h:718
int m_variableDD
Used to vary the density dependence each year
Definition: hare_all.h:764
void POMOutputs()
This method is called to dump the information needed for POM approaches.
Definition: Hare_all.cpp:1073
virtual void DoAlmostLast()
Called before clean-up of dead objects.
Definition: Hare_all.cpp:907
double GetMaxDailyGrowthEnergyF(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in fat construction.
Definition: hare_all.h:578
int GetMaleDensity(int x, int y)
Density function - returns the density of males in the square containing by x,y. Each square is 256x2...
Definition: hare_all.h:666
double GetGrowthEfficiency(int a_age)
Get the growth efficiency for this a_age.
Definition: hare_all.h:590
virtual void TheAOROutputProbe()
Output method.
Definition: Hare_all.cpp:1217
double GetKJperM(int a_size)
Get the cost of moving 1m in KJ dependent upon mass (.
Definition: hare_all.h:626
double m_DMWeight[5001]
Array for storing minimum acceptable size with age.
Definition: hare_all.h:746
FILE * BodyBurdenPrb
Definition: hare_all.h:790
double GetPolyFood(int a_poly)
Get stored polygon food quality.
Definition: hare_all.h:713
int m_HareThresholdDD
Input variable - Threshold density dependence level.
Definition: hare_all.h:750
double m_MaxDailyGrowthEnergy[5001]
Precalculated max growth energy requirement with size
Definition: hare_all.h:774
void Init()
Sets up data structures and calculations prior to starting simulation.
Definition: Hare_all.cpp:402
void SubtractHareDensity(int x, int y, Hare_Object a_type)
Density function - subtracts one from the density in the square containing by x,y....
Definition: hare_all.h:646
void MRROutputs()
Special probe for data to be used in mark-release-recapture simulations.
Definition: Hare_all.cpp:1232
double m_AdultMortRate
Input variable - Adult mortality rate.
Definition: hare_all.h:734
double m_MaxDailyGrowthEnergyP[5001]
Precalculated max growth energy requirement with size for protein
Definition: hare_all.h:778
double m_GrowthEfficiency[5001]
Precalculated growth efficiency with size
Definition: hare_all.h:776
int m_shot
Hunting Bag.
Definition: hare_all.h:756
int m_DensityMap[8][200][200]
Array storing densities measured in different ways
Definition: hare_all.h:762
virtual void DoFirst()
The first method called of the new time-step.
Definition: Hare_all.cpp:817
int GetDelayedAdultDensity(int x, int y)
Density function - returns the density of adults in the square containing by x,y, but for last year a...
Definition: hare_all.h:689
void HuntingGrid(void)
Definition: Hare_all.cpp:4227
double GetMaxDailyGrowthEnergyP(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in protein construction.
Definition: hare_all.h:565
double m_GrowthEfficiencyP[5001]
Precalculated growth efficiency for protein with size
Definition: hare_all.h:782
double m_MortStochast
Stochasticity around mortality parameters
Definition: hare_all.h:758
virtual ~THare_Population_Manager(void)
THare_Population_Manager destructor.
Definition: Hare_all.cpp:366
int GetLitterSize(int noLitters)
Returns the litter size.
Definition: Hare_all.cpp:744
void Hunting(void)
Definition: Hare_all.cpp:4131
void CalcLitterSize(double mean, double SD, int litter)
Definition: Hare_all.cpp:709
THare_Population_Manager(Landscape *L)
This is the constructor for the hare population manager.
Definition: Hare_all.cpp:383
double GetGrowthEfficiencyF(int a_age)
Get the growth efficiency for this a_age for creating fat.
Definition: hare_all.h:614
void HuntingDifferentiatedBeetleBankArea(void)
Definition: Hare_all.cpp:4178
double GetInterference(int h)
Return the proportion of time used in communicating with con-specifics.
Definition: hare_all.h:700
virtual void Catastrophe()
Annual global change in population numbers.
Definition: Hare_all.cpp:4046
double m_GrowthEfficiencyF[5001]
Precalculated growth efficiency for fat with size
Definition: hare_all.h:784
int GetAdultDensity(int x, int y)
Density function - returns the density of adults in the square containing by x,y. Each square is 256x...
Definition: hare_all.h:681
double * m_PolyFood
Temporary storage
Definition: hare_all.h:768
double m_Interference[2500]
Array storing density-dependence effect with density
Definition: hare_all.h:760
The base class for all hare classes.
Definition: hare_all.h:155
virtual void Running(int a_max_dist)
Run.
Definition: Hare_THare.cpp:152
void SetMum(Hare_Female *)
Set the mother pointer. Reimplemented in Hare_Infant.
Definition: hare_all.h:399
double ForageSquareP(int a_x, int a_y, double *a_pestexposure)
Forage from an area and resturn pesticide exposure as well as food.
Definition: HareForagenPeg.cpp:372
void st_Dying()
Tidy up before removing the object on death.
Definition: Hare_THare.cpp:172
int m_ddindex
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:281
double m_KJForaging
KJ/m cost of foraging per kg hare.
Definition: hare_all.h:238
int GetPegDistance()
Get peg distance.
Definition: HareForagenPeg.cpp:435
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: HareForagenPeg.cpp:551
double GetWeight()
Definition: hare_all.h:360
double m_old_weight
State variale - last hare weight.
Definition: hare_all.h:185
bool Run(int a_dist, int a_direction)
Run a distance in a direction.
Definition: Hare_THare.cpp:193
bool OnFarmEvent(FarmToDo event)
Do we require a response to a farm event.
Definition: Hare_THare.cpp:372
virtual void Step(void)
Base implementation only - reimplemented.
Definition: hare_all.h:349
void EnergyBalance(TTypeOfActivity a_activity, int dist)
Adjust energy balance for an activity.
Definition: Hare_THare.cpp:277
double Forage(int &time)
Foraging.
Definition: HareForagenPeg.cpp:54
virtual void BeginStep(void)
Base implementation only - reimplemented.
Definition: hare_all.h:344
int m_experiencedDensity
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:271
double m_SpeedRunning
m/min speed of running per kg hare
Definition: hare_all.h:243
void TimeBudget(TTypeOfActivity a_activity, int dist)
Adjust time budger for an activity.
Definition: Hare_THare.cpp:314
Hare_Female * m_MyMum
Pointer to the hare's mum.
Definition: hare_all.h:190
Hare_Object m_Type
State variale - the type of hare.
Definition: hare_all.h:175
virtual bool WasPredated()
Test for predation.
Definition: Hare_THare.cpp:357
double m_SpeedWalking
m/min speed of walking per kg hare
Definition: hare_all.h:248
double GetRMR()
Get todays RMR.
Definition: Hare_THare.cpp:349
int GetRefNum()
Get the refnum for this hare.
Definition: hare_all.h:419
double GetTotalWeight()
Provide the wet weight of the hare.
Definition: hare_all.h:370
static double * m_vegPalatability
Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetatio...
Definition: hare_all.h:318
void loadVegPalatability(void)
Loads static member m_vegPalatability with data.
Definition: Hare_THare.cpp:116
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: hare_all.h:301
int m_peg_x
peg x-coordinate
Definition: hare_all.h:256
double m_foragingenergy
Energy obtained from foraging/feeding.
Definition: hare_all.h:252
Hare_Female * GetMum()
Get the mother pointer.
Definition: hare_all.h:404
int GetAge()
Definition: hare_all.h:377
int m_ActivityTime
Minutes of potential activity time per day.
Definition: hare_all.h:203
void THareInit(int p_x, int p_y, THare_Population_Manager *p_PPM)
Object Initiation.
Definition: Hare_THare.cpp:72
bool m_pesticideInfluenced1
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects u...
Definition: hare_all.h:311
virtual ~THare()
Destructor.
Definition: Hare_THare.cpp:111
int m_peg_y
peg y-coordinate
Definition: hare_all.h:260
int GetPegPull()
Get attractive force of peg.
Definition: HareForagenPeg.cpp:451
void MovePeg()
Move the peg according to attraction forces.
Definition: HareForagenPeg.cpp:527
void Walking(int a_dist, int a_direction)
Walking.
Definition: Hare_THare.cpp:183
virtual TTypeOfHareState st_Dispersal()
Base implementation only - reimplemented.
Definition: Hare_THare.cpp:138
virtual void GeneralEndocrineDisruptor(double)
Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this m...
Definition: hare_all.h:482
double ForageP(int &time)
Foraging but also incorporating pesticide exposure.
Definition: HareForagenPeg.cpp:181
void ON_MumDead(Hare_Female *a_Mum)
Inform Mum that we are dead.
Definition: hare_all.h:387
int m_RefNum
Unique hare reference number, also functions as sex flag.
Definition: hare_all.h:265
int m_DensitySum
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:291
double m_EnergyMax
State variable - the amount of energy it is possible to eat as a multiplyer or RMR.
Definition: hare_all.h:223
TTypeOfHareState m_CurrentHState
Defines the current activity.
Definition: hare_all.h:165
double m_KJWalking
KJ/m cost of walking per kg hare.
Definition: hare_all.h:233
double ForageSquare(int a_x, int a_y)
Forage from an area.
Definition: HareForagenPeg.cpp:322
int GetPegDirection()
Get direction of peg.
Definition: HareForagenPeg.cpp:460
int m_Age
State variale - hare age.
Definition: hare_all.h:170
int m_lastYearsDensity
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:276
int m_expDensity[365]
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:286
bool m_IamSick
flag for sickness - used in conjunction with disease configurations
Definition: hare_all.h:295
double m_weight
State variale - hare weight g.
Definition: hare_all.h:180
THare(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
Constructor.
Definition: Hare_THare.cpp:66
double m_fatReserve
State variable - the energy reserve of the hare.
Definition: hare_all.h:213
double m_TodaysEnergy
State variable - the amount of energy available today, can be in deficit.
Definition: hare_all.h:218
double m_KJRunning
KJ/m cost of running per kg hare.
Definition: hare_all.h:228
THare_Population_Manager * m_OurPopulationManager
Pointer to the hare population manager.
Definition: hare_all.h:194
int m_StarvationDays
State variable - the number of consecutive days in negative energy balance.
Definition: hare_all.h:208
double m_pesticidedegradationrate
State variable used to hold the daily degredation rate of the pesticide in the body.
Definition: hare_all.h:306
virtual void EndStep(void)
Base implementation only - reimplemented.
Definition: hare_all.h:354
virtual void ON_Dead(void)
Mortality - overridden in descendent classes.
Definition: hare_all.h:424
virtual void GeneralOrganoPhosphate(double)
Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method...
Definition: hare_all.h:487
int m_Lifespan
Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age)
Definition: hare_all.h:198
Class used to pass hare information to CreateObjects.
Definition: hare_all.h:135
int y
Definition: hare_all.h:138
int x
Definition: hare_all.h:137
Landscape * L
Definition: hare_all.h:140
int RefNum
Definition: hare_all.h:143
double weight
Definition: hare_all.h:144
THare_Population_Manager * HM
Definition: hare_all.h:141
int age
Definition: hare_all.h:139
Hare_Female * Mum
Definition: hare_all.h:142
TTypeOfActivity
Enumerator for hare activities.
Definition: hare_all.h:89
@ activity_gestation
Definition: hare_all.h:98
@ activity_Walking
Definition: hare_all.h:93
@ activity_Recovery
Definition: hare_all.h:95
@ activity_nonAdult
Definition: hare_all.h:101
@ activity_inoestrous
Definition: hare_all.h:97
@ activity_oestrouscycle
Definition: hare_all.h:96
@ activity_lactation
Definition: hare_all.h:100
@ activity_Resting
Definition: hare_all.h:90
@ activity_Dispersal
Definition: hare_all.h:94
@ activity_Running
Definition: hare_all.h:91
@ activity_givebirth
Definition: hare_all.h:99
@ activity_Foraging
Definition: hare_all.h:92
vector< THare * > TListOfHares
Definition: hare_all.h:44
TTypeOfHareState
Enumerator for hare behavioural states.
Definition: hare_all.h:70
@ tohs_Foraging
Definition: hare_all.h:75
@ tohs_Developing
Definition: hare_all.h:73
@ tohs_NextStage
Definition: hare_all.h:72
@ tohs_InitialState
Definition: hare_all.h:71
@ tohs_Resting
Definition: hare_all.h:76
@ tohs_Dispersal
Definition: hare_all.h:74
@ tohs_DestroyObject
Definition: hare_all.h:80
@ tohs_Dying
Definition: hare_all.h:79
@ tohs_Running
Definition: hare_all.h:78
@ tohs_ReproBehaviour
Definition: hare_all.h:77
Hare_Object
Definition: hare_all.h:56
@ hob_Male
Definition: hare_all.h:60
@ hob_Infant
Definition: hare_all.h:57
@ hob_Young
Definition: hare_all.h:58
@ hob_Female
Definition: hare_all.h:61
@ hob_Juvenile
Definition: hare_all.h:59
@ hob_Foobar
Definition: hare_all.h:62
Data entry for mark release recapture data MRR_Data.
Definition: hare_all.h:108
int m_trappings2
Definition: hare_all.h:111
int m_trappings1
Definition: hare_all.h:110
int m_HareRefNum
Definition: hare_all.h:109
FarmToDo
Definition: treatment.h:31